﻿@using zichan.Entity
@model IPagedList<CabinetUseLog>
@{
    ViewBag.Title = "Index";
}
<style>
    #pagebar li {
        display: inline-block;
    }
</style>
<div class="portlet">
    <div class="portlet-title">
        <div class="caption ">
            <i class="fa fa-table"></i>机柜日志
        </div>
    </div>
    <div class="portlet-body">
        <div class="table-container">
            <div class="dataTables_wrapper dataTables_extended_wrapper no-footer">
                <div class="table-scrollable">
                    <table class="table  table-hover">
                        <thead>
                            <tr class="heading">
                                <th>时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (CabinetUseLog r in Model)
                            {
                                <tr>
                                   
                                    <td>@r.Time</td>
                                    <td>@r.Operation</td>
                                   
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                        @if (Model.PageCount > 1)
                        {
                            <div class="row">
                                <div class="col-sm-12 dataTables_paginate">
                                    <div class="pull-right">
                                        <ul id="pagebar" style="display:inline-block;margin-right:10px;">
                                            <li>
                                                每页<select name="pageSize" id="pageSize" class="select2" style="width:50px;font-size:18px;">
                                                    <option value="@ViewBag.pageSize">@ViewBag.pageSize</option>
                                                    @foreach (var s in ViewBag.pageSizes)
                                                    {
                                                        <option value="@s.Value">@s.Text</option>
                                                    }
                                                </select>个
                                            </li>
                                            <li>第@(Model.PageNumber)/共@(Model.PageCount)页</li>
                                            @using (Html.BeginForm("index", "CabinetLog", FormMethod.Get, new { @style = "display: inline-block;" }))
                                            {
                                                <li style="display:none;">
                                                    <input type="hidden" name="pageSize" value="@ViewBag.pageSize" />
                                                    @Html.TextBox("pageCount", Model.PageCount)
                                                </li>
                                                <li>跳转至<input name="selectedPage" style="width:40px;font-size:18px;" value="@ViewBag.selectedPage" />页</li>
                                                <li><button type="submit">GO</button></li>}
                                        </ul>
@if (Model.PageCount > 1)
{
                                        <ul id="pagebar" class="pagination" style="margin:0px;float:right;">
                                            <li><a href="@Url.Action("Index", "CabinetLog", new { pageSize = ViewBag.pageSize,page = 1 })">首页</a></li>
                                            <li>@Html.ActionLink("上一页", "Index", "CabinetLog", new { pageSize = ViewBag.pageSize, page = Model.PageNumber - 1 }, null)</li>
                                            <li>@Html.ActionLink("下一页", "Index", "CabinetLog", new { pageSize = ViewBag.pageSize, page = (Model.PageNumber + 1 < Model.PageCount ? Model.PageNumber + 1 : Model.PageCount) }, null)</li>
                                            <li>@Html.ActionLink("末页", "Index", "CabinetLog", new { pageSize = ViewBag.pageSize, page = Model.PageCount }, null)</li>
                                        </ul>}
                                    </div>

                                </div>
                            </div>
                        }
            </div>

        </div>
    </div>
</div>
@section footer{
    <script type="text/javascript">
        $(function () {
            $('#pageSize').on("change", function () {
                var size = $(this).val();
                location.href = "/CabinetLog/Index?pageSize=" + size;
            });
        });

    </script>
}